from flask import Blueprint, jsonify

from applications.models import Challenge
from applications.schemas import ChallengeSchema

bp = Blueprint('challenge', __name__, url_prefix='/challenge')

@bp.get('/')
def login():
    print("challenge")
    data = Challenge.query.limit(5)

    res = {
        "data": ChallengeSchema(many=True).dump(data)
    }
    return jsonify(res)